import project from './project';
import group from './group';
import util from '../util';
import language from './language';
import languageList from './languageList';
import LICENSE from './LICENSE'
class builder {
  //项目名字
  private _projectName!: string;
  //项目描述
  private _projectDescription!: string;
  //项目路径
  private _rootPath!: string;
  //项目文件组
  private _fileGroup!: group;
  //项目作者列表
  private _author!: string[];
  //项目语言
  private _language!: language;
  //项目LICENSE
  private _LICENSE!: LICENSE;
  //设置项目名称
  public setProjectName(value: string): builder {
    this._projectName = value;
    return this;
  }
  //设置项目描述
  public setDescription(value: string): builder {
    this._projectDescription = value;
    return this;
  }
  //设置项目 ？
  public setRootPath(value: string): builder {
    this._rootPath = value;
    return this;
  }
  //设置项目文件组
  public setFileGroup(value: group): builder {
    this._fileGroup = value;
    return this;
  }
  //设置项目作者列表
  public setAuthor(value: string[]): builder {
    this._author = value;
    return this;
  }
  //设置项目语言
  public setLanguage(rValue: languageList, nValue: languageList): builder {
    this._language = new language(rValue, nValue);
    return this;
  }
  //设置LICENSE
  public setLICENSE(value: LICENSE): builder {
    this._LICENSE = value;
    return this;
  }
  public build(): project {
    let pro = new project();
    pro.setProjectName(this._projectName);
    pro.setRootPath(this._rootPath);
    pro.setFileGroup(this._fileGroup);
    pro.setAuthor(this._author);
    pro.setLanguage(this._language);
    pro.setProjectDescription(this._projectDescription);
    pro.setLICENSE(this._LICENSE);
    let date = util.getNowDate();
    pro.setCreateDate(date);
    pro.setLastVisitDate(date);
    pro.setLastEditDate(date);
    return pro;
  }
}

export default builder;
